﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.ThirdPartyExtensions;
using System.IO;
using Common.Utility;
using System.Data;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using System.Threading;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading.Tasks;
using Common.Utility.Extensions;
namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(DateTime.Now + " start...");
            try
            {

                string str = "press any key to close.press any key to close.";
                var result = DateTimeHelper.ToUnixTime(DateTime.Parse("2013-1-1"));
                var dt = DateTimeHelper.FromUnixTime(result);
                var aa = str.Split("press");
                //                declare  @IntCollectionTVP IntCollectionTVP
                //insert into @IntCollectionTVP values(1)

                //select  * from CommissionRuleGroup
                //where exists(select 1 from @IntCollectionTVP  
                //where @IntCollectionTVP.ID=CommissionRuleGroup.ID)

                string connectionString = @"server =LIUZHAO-X200\SQLEXPRESS; uid = sa ;pwd = 2328725 ;database = Northwind";



                DataTable resultDt = new DataTable();
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    SqlCommand comm = conn.CreateCommand();
                    comm.CommandText = @"select * from Orders(nolock) where OrderID=@OrderID";


                    //这里的TypeName对应我们定义的表值函数名
                    comm.Parameters.Add(new SqlParameter("@OrderID", SqlDbType.Int) { Value = 10249 });
                    comm.Prepare();
                    comm.ExecuteNonQuery();
                    //using (SqlDataAdapter adapter = new SqlDataAdapter(comm))
                    //{
                    //    adapter.SelectCommand = comm;
                    //    adapter.Fill(resultDt);
                    //}
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.WriteLine(DateTime.Now + " over");
            Console.WriteLine("press any key to close.");
            Console.ReadKey();

        }



        static void aa(HashSet<long> collection, string separator = ",")
        {
            Thread thread = new Thread(() =>
            {

            });
            thread.IsBackground = true;
            thread.Start();
            thread.Abort();
        }


    }
}
